﻿using Gargoyle.Roton;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;

namespace Gargoyle.ZZT
{
    public class Board
    {
		/// <summary>
		/// Total area of the board.
		/// </summary>
        public readonly int Area;

		/// <summary>
		/// If true, the board is dark.
		/// </summary>
        public byte Dark;

		/// <summary>
		/// Entry location of the player on this board.
		/// </summary>
        public Location Enter;

		/// <summary>
		/// Index of the board exit to the east.
		/// </summary>
        public byte ExitEast;

		/// <summary>
		/// Index of the board exit to the north.
		/// </summary>
        public byte ExitNorth;

		/// <summary>
		/// Index of the board exit to the south.
		/// </summary>
        public byte ExitSouth;

		/// <summary>
		/// Index of the board exit to the west.
		/// </summary>
        public byte ExitWest;

		/// <summary>
		/// Height of the board, in tiles.
		/// </summary>
        public readonly int Height;

		/// <summary>
		/// Message to be displayed on the board.
		/// </summary>
        public ByteString Message;

		/// <summary>
		/// Name of the board.
		/// </summary>
        public ByteString Name;

		/// <summary>
		/// If true, when the player is hurt by an enemy, it will be placed at the entry location.
		/// </summary>
        public byte RestartOnZap;

		/// <summary>
		/// Maximum number of shots that the player can fire on this board.
		/// </summary>
        public byte Shots;

		/// <summary>
		/// Collection of things on this board.
		/// </summary>
        public ThingCollection Things;

		/// <summary>
		/// Tiles on this board.
		/// </summary>
        public readonly Tile[] Tiles;
		
		/// <summary>
		/// Time limit for this board, in seconds.
		/// </summary>
        public Int16 TimeLimit;

		/// <summary>
		/// Width of this board, in tiles.
		/// </summary>
        public readonly int Width;

        /// <summary>
        /// Indicates whether the board uses the garbled SuperLock title.
        /// </summary>
        public bool IsSuperLocked;

		/// <summary>
		/// Create a new board with the specified dimensions.
		/// </summary>
        public Board(int newWidth, int newHeight)
        {
            Width = newWidth;
            Height = newHeight;
            Area = Width * Height;
            Tiles = new Tile[Area];
        }

        public override string ToString()
        {
            return "Board (Name=" + Name + ")";
        }
    }
}
